/*
 * Copyright 2011 The Rusted Roof, LLC.
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */

package org.proteusframework.api.config;

import org.proteusframework.api.IRuntimeConfiguration;
import org.proteusframework.runtime.InvalidConfigurationException;

import java.io.InputStream;

/**
 * Load a Proteus runtime configuration that is fed to the runtime engine.
 *
 * @author Tacoma Four
 */
public interface IConfigurationLoader
{

    /**
     * Load a runtime configuration from the given input stream. The exact format of the input stream is defined by the
     * runtime environment, not the Proteus Framework. In other words, one platform implementation may opt for an XML
     * representation, while another platform implementation may opt for serialized Java objects.
     *
     * @param source Input stream used to load the runtime engine configuration
     * @return Runtime configuration
     * @throws org.proteusframework.runtime.InvalidConfigurationException
     *          when a configuration could not be loaded from the specified input stream
     */
    IRuntimeConfiguration load(InputStream source) throws InvalidConfigurationException;
}
